import { Scalar as r } from '../../nodes/Scalar.js';
import { stringifyNumber as n } from '../../stringify/stringifyNumber.js';
const l = {
    identify: t => typeof t == 'number',
    default: !0,
    tag: 'tag:yaml.org,2002:float',
    test: /^[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN)$/,
    resolve: t =>
      t.slice(-3).toLowerCase() === 'nan'
        ? NaN
        : t[0] === '-'
          ? Number.NEGATIVE_INFINITY
          : Number.POSITIVE_INFINITY,
    stringify: n,
  },
  s = {
    identify: t => typeof t == 'number',
    default: !0,
    tag: 'tag:yaml.org,2002:float',
    format: 'EXP',
    test: /^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,
    resolve: t => parseFloat(t.replace(/_/g, '')),
    stringify(t) {
      const e = Number(t.value);
      return isFinite(e) ? e.toExponential() : n(t);
    },
  },
  g = {
    identify: t => typeof t == 'number',
    default: !0,
    tag: 'tag:yaml.org,2002:float',
    test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
    resolve(t) {
      const e = new r(parseFloat(t.replace(/_/g, ''))),
        o = t.indexOf('.');
      if (o !== -1) {
        const a = t.substring(o + 1).replace(/_/g, '');
        a[a.length - 1] === '0' && (e.minFractionDigits = a.length);
      }
      return e;
    },
    stringify: n,
  };
export { g as float, s as floatExp, l as floatNaN };
